package prj.carmap.mobile.activity;

import com.actionbarsherlock.app.ActionBar.LayoutParams;
import com.actionbarsherlock.app.SherlockActivity;

import prj.carmap.mobile.CarmapApplication;
import prj.carmap.mobile.R;
import prj.carmap.mobile.process.ChangePasswdProcess;
import prj.carmap.mobile.process.LoginProcess;
import prj.carmap.mobile.process.SellerTypeProcess;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * 修改密码界面
 *
 */
public class ChangePasswordActivity extends SherlockActivity {

	static final String TAG = "ChangePasswordActivity";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		CarmapApplication.addActivity(this);
		setContentView(R.layout.activity_changepwd);
		// Inflate the custom view
		View customNav = LayoutInflater.from(this).inflate(R.layout.nav_seller_title_view, null);
		getSupportActionBar().setDisplayShowCustomEnabled(true);
		getSupportActionBar().setDisplayShowHomeEnabled(false);
		getSupportActionBar().setDisplayShowTitleEnabled(false);
		((TextView) customNav.findViewById(R.id.nav_title)).setText("修改密码");
		LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER);
		getSupportActionBar().setCustomView(customNav);
		customNav.setLayoutParams(lp);

		// ActionBarf返回按钮
		Button returnBtn = (Button) customNav.findViewById(R.id.return_prev);
		returnBtn.setOnClickListener(new Button.OnClickListener() {// 创建监听
					public void onClick(View v) {
						ChangePasswordActivity.this.finish();
					}
				});
		Button mapBtn = (Button) customNav.findViewById(R.id.return_map);
		mapBtn.setVisibility(View.GONE);
		//new UpdateVersionTask(this).checkVersion();

		init();
		//initMenuItem();
		//initActionBar();
	}

	private void init() {
		//修改密码界面和处理器绑定
		Button btnChange = (Button) findViewById(R.id.btnChange);
		ChangePasswdProcess changeP = new ChangePasswdProcess();
		changeP.setBtnChange(btnChange);
		changeP.setContext(this);
		changeP.setTxtOriginalPasswd((EditText) findViewById(R.id.txtOriginalPasswd));
		changeP.setTxtNewPasswd((EditText) findViewById(R.id.txtNewPasswd));
		changeP.setTxtNewPasswdAgain((EditText) findViewById(R.id.txtNewPasswdAgain));
		btnChange.setOnClickListener(changeP);
	}

	@Override
	protected void onResume() {
		super.onResume();
	}
}
